#include "label.h"

Label::Label(QWidget* parent) : QLabel(parent)
{

}
// 鼠标进入
void Label::enterEvent(QEvent *event)
{
    (void) event;
    qDebug() << "enterEvent";
}
// 鼠标离开
void Label::leaveEvent(QEvent *event)
{
    (void) event;
    qDebug() << "leaveEvent";
}
// 鼠标点击
void Label::mousePressEvent(QMouseEvent *event)
{
    (void) event;
    if(event->button() == Qt::LeftButton)
        qDebug() << "LeftButton点击";
    else if(event->button() == Qt::RightButton)
        qDebug() << "RightButton点击";
    qDebug() << "mousePressEvent:" << "(" << event->x() << "," << event->y()
             << "),(" << event->globalX() << "," << event->globalY() << ")";
}
// 鼠标释放
void Label::mouseReleaseEvent(QMouseEvent *event)
{
    (void) event;
    if(event->button() == Qt::LeftButton)
        qDebug() << "LeftButton释放";
    else if(event->button() == Qt::RightButton)
        qDebug() << "RightButton释放";
    qDebug() << "mouseReleaseEvent:" << "(" << event->x() << "," << event->y()
             << "),(" << event->globalX() << "," << event->globalY() << ")";
}

void Label::mouseDoubleClickEvent(QMouseEvent *event)
{
    (void) event;
    if(event->button() == Qt::LeftButton)
        qDebug() << "LeftButton双击";
    else if(event->button() == Qt::RightButton)
        qDebug() << "RightButton双击";
    qDebug() << "mouseDoubleClickEvent:" << "(" << event->x() << "," << event->y()
             << "),(" << event->globalX() << "," << event->globalY() << ")";
}
